package com.example.dml.observer_pattern.test;

import java.util.Observable;

/**
 * @Authors：gaoyang
 * @CreateTime：2021/11/2 22:43
 * @Description：todo
 */
public class Gper extends Observable {

    private String name = "GPer圈";
    private static Gper gper = null;

    private Gper(){}

    public static Gper getInstance(){
        if (null==gper){
            gper = new Gper();
        }
        return gper;
    }

    public String getName() {
        return name;
    }

    public void publishQuestion(Question question){
        System.out.println(question.getUserName()+"在"+this.name+"上提交一个问题。");
        setChanged();
        notifyObservers(question);
    }
}
